package com.example.s09thymeleaf.controller;


import com.example.s09thymeleaf.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class ForController {
    @GetMapping("/for")
    public String showList(Model model){
        String [] names={"张三","李四","黄武"};

        List<Student> students = new ArrayList<>();

        students.add(new Student("张三",20));
        students.add(new Student("里斯",20));
        students.add(new Student("Join",22));
        model.addAttribute("names",names);
        model.addAttribute("students",students);

        return "for";

    }
}

